<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.com/products/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:rich="http://richfaces.org/rich"
    xmlns:a="http://richfaces.org/a4j"
    template="/layout/template.xhtml">

<ui:define name="body">

    <h:form id="deferirIsentoForm">

        <rich:panel>
            <f:facet name="header">Deferir Isento</f:facet>

            <s:decorate id="nossoNumeroField" template="/layout/edit.xhtml">
                <ui:define name="label">#{messages.nossoNumero}</ui:define>
                <h:inputText id="nossoNumero" required="true" value="#{deferirIsento.nossoNumero}"/>
            </s:decorate>

            <div style="clear:both"/>

        </rich:panel>

        <div class="actionButtons">
        	<h:commandButton id="consultarID" value="Consultar" action="#{deferirIsento.buscaCandidato}" >
        		<a:support event="onclick" reRender="divCandidato" />
        	</h:commandButton>
        </div>
        
        
        <s:div id="divCandidato">
	        <rich:panel>
	            <f:facet name="header">Candidato</f:facet>
	            
	            <s:decorate id="nomeField" template="/layout/display.xhtml">
	                <ui:define name="label">Nome</ui:define>
	                <h:outputText id="nomeId" value="#{candidato.nome}"/>
	            </s:decorate>
	            
	            <s:decorate id="cargoField" template="/layout/display.xhtml">
	                <ui:define name="label">Cargo</ui:define>
	                <h:outputText id="cargoId" value="#{candidato.cargo.codigo} - #{candidato.cargo.nome}" rendered="#{candidato.cargo.codigo != null}"/>
	            </s:decorate>
	            
	            <s:decorate id="cpfField" template="/layout/display.xhtml">
	                <ui:define name="label">CPF</ui:define>
	                <h:outputText id="cpfId" value="#{candidato.cpf}"/>
	            </s:decorate>
	            
	            <s:decorate id="dataNscimentoField" template="/layout/display.xhtml">
	                <ui:define name="label">Data Nascimento</ui:define>
	                <h:outputText id="dataNascimentoId" value="#{candidato.dataNascimento}">
	                	<f:convertDateTime pattern="dd/MM/yyyy" />
	                </h:outputText>
	            </s:decorate>
	            
	            <s:decorate id="numeroInscricaoField" template="/layout/display.xhtml">
	                <ui:define name="label">#{messages.numeroInscricao}</ui:define>
	                <h:outputText id="numeroInscricaoId" value="#{candidato.numeroInscricaoFormatado}"/>
	            </s:decorate>
	            
	            <s:decorate id="statusPagamentoField" template="/layout/display.xhtml">
	                <ui:define name="label">#{messages.situacao}</ui:define>
	                <h:outputText id="statusPagamentoAPGId" value="#{messages.aguardandoPago}" rendered="#{candidato.statusPagamento eq 'APG'}"/>
	                <h:outputText id="statusPagamentoISTId" value="#{messages.isento}" rendered="#{candidato.statusPagamento eq 'IST'}"/>
	                <h:outputText id="statusPagamentoPGId" value="#{messages.pago}" rendered="#{candidato.statusPagamento eq 'PG'}"/>
	                <h:outputText id="statusPagamentoNPGId" value="#{messages.naoPago}" rendered="#{candidato.statusPagamento eq 'NPG'}"/>
	                <h:outputText id="statusPagamentoDESId" value="#{messages.aguardandoPagoDesconto}" rendered="#{candidato.statusPagamento eq 'DES'}"/>
	                <h:outputText id="statusPagamentoPGDId" value="#{messages.pagoComDesconto}" rendered="#{candidato.statusPagamento eq 'PGD'}"/>
	            </s:decorate>
	            
		        <div style="clear:both"/>

			</rich:panel>
			
				            
		<h:commandButton value="Deferir" action="#{deferirIsento.deferirIsento}"  disabled="#{!deferirIsento.habilita()}" >
			<a:support event="onclick" reRender="divCandidato" />
		</h:commandButton>
		
		<h:commandButton value="#{messages.naoDeferirDesconto}" action="#{deferirIsento.naoDeferirIsento}"  disabled="#{!deferirIsento.habilita()}" >
			<a:support event="onclick" reRender="divCandidato" />
		</h:commandButton>
		
        </s:div>





    </h:form>

</ui:define>

</ui:composition>
